package com.ruoyi.zhjd.laboratory.modules.tensionResult.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.ruoyi.zhjd.laboratory.modules.tensionResult.entity.TensionResult;
import com.ruoyi.zhjd.laboratory.modules.tensionResult.mapper.LTensionResultMapper;
import com.ruoyi.zhjd.laboratory.modules.tensionResult.service.LTensionResultService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 张拉结果(TensionResult)表服务实现类
 *
 * @author makejava
 * @since 2023-07-12 14:24:14
 */
@AllArgsConstructor
@Service("tensionResultService")
public class LTensionResultServiceImpl extends ServiceImpl<LTensionResultMapper, TensionResult> implements LTensionResultService {

//    @Autowired
//    private BaseServiceComponent baseServiceComponent;

    @Override
    public IPage<TensionResult> page(Map<String, Object> params) {
//        IPage<TensionResult> page = baseServiceComponent.getPage(params, TensionResult.class);
        return baseMapper.query(null, params);
    }

    /**
     * 查询单个
     *
     * @param id
     * @return
     */
    @Override
    public TensionResult getInfoById(String id) {
        return getById(id);
    }

    /**
     * 新增
     *
     * @param tensionResult
     */
    @Override
    public void insertTensionResult(TensionResult tensionResult) {
        tensionResult.setId(IdWorker.get32UUID());
        //创建者
//        tensionResult.setCreateBy(SecurityUser.getUserId() == null ? null : SecurityUser.getUserId());
        //创建时间
//        tensionResult.setCreateTime(DateUtils.getDate("yyyy-MM-dd HH:mm:ss"));
        save(tensionResult);
    }

    /**
     * 修改
     *
     * @param tensionResult
     */
    @Override
    public void updateTensionResult(TensionResult tensionResult) {
        //修改者
//        tensionResult.setUpdateBy(SecurityUser.getUserId() == null ? null : SecurityUser.getUserId());
        //修改时间
//        tensionResult.setUpdateTime(DateUtils.getDate("yyyy-MM-dd HH:mm:ss"));
        updateById(tensionResult);
    }

    /**
     * 删除 单个/多个
     *
     * @param ids
     */
    @Override
    public void deleteByIds(List<String> ids) {
        removeByIds(ids);
    }
}

